package com.bio.test1;

import java.net.ServerSocket;
import java.net.Socket;

/**
 * 服务端，直接new Thread的方式
 * @author gxkj-042
 *
 */
public class Service {
	
	final static int port = 8765;
	
	public static void main(String[] args) {
		ServerSocket server = null;
		try {
			server = new ServerSocket(port);
			System.out.println("服务已经启动....");
			//阻塞服务
			Socket socket = server.accept();
			//新建一个线程执行
			new Thread(new ServerHandler(socket)).start();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
